home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pcscheme / geneva / sources.exe / SOURCES / STEP / STEP.S < prev    next >
Encoding:
Text File  |  1993-09-23  |  2.4 KB  |  61 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;
  3. ;;;     MODULE: STEP
  4. ;;;
  5. ;;;     Purpose:        This Module defines the step-macro.
  6. ;;;
  7. ;;;     Installation:    Load "step.*" in your "scheme.ini" or
  8. ;;;            copy it to your "scheme.ini". A macro can
  9. ;;;            not be loaded automaticly.
  10. ;;;
  11. ;;;    Notes:        The single stepper is invoked by 
  12. ;;;                     placing the expression to step
  13. ;;;                     inside a 'call' to step: 
  14. ;;;                             "(step <expression> [halt] [reset]")
  15. ;;;
  16. ;;;                     Currently `step' accepts two options, 
  17. ;;;                     namely `halt' and `reset'. 
  18. ;;;
  19. ;;;                     `halt' halts execution immediately after
  20. ;;;                     evaluating the step expression. This is usefull
  21. ;;;                     if the stepper was in "go-mode", when `reset'
  22. ;;;                     was called.
  23. ;;;             
  24. ;;;                     `reset' resets all variables to a known state.
  25. ;;;                     See option `halt' for purpose.
  26. ;;;
  27. ;;;     Bugs:           See "stepwrap.sc"
  28. ;;;                     
  29. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  30.  
  31. (macro step
  32.   (lambda (expr)
  33.     (let ((arg (cadr expr)))
  34.       (if (or (procedure? arg)
  35.               (environment? arg)
  36.               ;((port? arg)) `port?' seems to be buggy
  37.           )
  38.           (syntax-error "can't step expression" arg))
  39.       (for-each
  40.         (lambda (arg)
  41.           (case arg
  42.             (halt
  43.               ; If "stepaux.fsl" is not loaded, do nothing
  44.               (if (not
  45.                     (and (unbound? step-stop-depth user-global-environment)
  46.                          (unbound? step-stop-depth user-initial-environment)))
  47.                   (set! step-stop-depth -1)))
  48.             (reset
  49.               ; If "stepaux.fsl" is not loaded, do nothing
  50.               (if (not 
  51.                     (and (unbound? step-stop-depth user-global-environment)
  52.                          (unbound? step-stop-depth user-initial-environment)))
  53.                   (set! step-call-depth  0)))
  54.             (else
  55.               (syntax-error "invalid option to step" arg))))
  56.         (cddr expr))
  57.       ; `(access wrap step-environment)' makes it impossible to 
  58.       ; autoload "step.fsl"
  59.       (let ((wrap (eval 'wrap step-environment)))
  60.         (wrap (cadr expr))))))
  61.